<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8">
	<meta charset="utf-8">
	<title>修改工位 - ${siteName}</title>
	<meta name="description" content="">
	<meta name="author" content="xuzewei">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1, user-scalable=no">
	<link rel="stylesheet" type="text/css" href="css/cloud-admin.css" >
	<link rel="stylesheet" type="text/css" href="css/themes/default.css" id="skin-switcher" >
	<link rel="stylesheet" type="text/css" href="css/responsive.css" >
	<link rel="stylesheet" type="text/css" href="font-awesome/css/font-awesome.min.css">
	<!-- JQUERY UI-->
	<link rel="stylesheet" type="text/css" href="js/jquery-ui-1.10.3.custom/css/custom-theme/jquery-ui-1.10.3.custom.min.css" />
	<!-- DATE RANGE PICKER -->
	<link rel="stylesheet" type="text/css" href="js/bootstrap-daterangepicker/daterangepicker-bs3.css" />
	<!-- JQGRID -->
	<link rel="stylesheet" type="text/css" href="js/jqgrid/css/ui.jqgrid.min.css" />
	<!-- HUBSPOT MESSENGER -->
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger.min.css" />
	<link rel="stylesheet" type="text/css" href="js/hubspot-messenger/css/messenger-theme-flat.min.css" />
	<link rel="stylesheet" type="text/css" href="css/base.css" />
	<link rel="stylesheet" type="text/css" href="css/main.css" />
</head>
<body id="app" ng-app="app" ng-controller="ctrl">
	<!-- HEADER -->
	<jsp:include page="include/header.jsp" />
	<!--/HEADER -->
	<!-- PAGE -->
	<section id="page">
		<!-- SIDEBAR -->
		<jsp:include page="include/sidebar.jsp" />
		<!-- /SIDEBAR -->
		<div id="main-content">
			<div class="container">
				<div class="row">
					<div id="content" class="col-lg-12">
						<!-- PAGE HEADER-->
						<div class="row">
							<div class="col-sm-12">
								<div class="page-header">
									<!-- BREADCRUMBS -->
									<ul class="breadcrumb">
										<li>
											<i class="fa fa-home"></i>
											<a href="welcome.jsp">Home</a>
										</li>
									</ul>
									<!-- /BREADCRUMBS -->
									<div class="clearfix">
										<h3 class="content-title pull-left">修改工位</h3>
									</div>
									<div class="description"></div>
								</div>
							</div>
						</div>
						<!-- /PAGE HEADER -->
						<div class="box border orange">
							<div class="box-title">
								<h4><i class="fa fa-bars"></i>修改新工位</h4>
							</div>
							<div class="box-body big">
								<form role="form" action="api/resourecStation/edit" method="post">
									<!-- <div class="form-group">
									  <label>所属区域或名称</label>
									  <input type="text" class="form-control" ng-model="resp.zone" >
									</div> -->
									<div class="form-group">
									  <label>工位位置名称</label>
									  <input type="text" class="form-control" name="name" ng-model="resp.name" >
									</div>
									<div class="form-group">
									  <label>租金标准(元/月)</label>
									  <input type="text" class="form-control" required="required" pattern=""  name="rental" ng-model="resp.rental">
									  
									</div>
									<input type="hidden" name="id" value="${param.id}">
									<!-- <div class="form-group">
									  <label>状态</label>
									  <select  class="form-control" ng-model="state1"  ng-options="o for o in stateType">
									  	<option value="">-- 请选择类型 --</option>
									  	 <option  value='0'>空闲</option>
									  	<option  value='1'>出租</option>
									  	<option  value='2'>锁定</option>
									  </select>
									</div> -->
									
									<button type="submit" class="btn btn-danger" >提交</button>
								</form>
							</div>
						</div>
						<div class="footer-tools">
							<span class="go-top">
								<i class="fa fa-chevron-up"></i> Top
							</span>
						</div>
					</div><!-- /CONTENT-->
				</div>
			</div>
		</div>
	</section>
	<!--/PAGE -->
	
	<!-- JAVASCRIPTS -->
	<!-- Placed at the end of the document so the pages load faster -->
	<!-- JQUERY -->
	<script src="js/jquery/jquery-2.0.3.min.js"></script>
	<!-- JQUERY UI-->
	<script src="js/jquery-ui-1.10.3.custom/js/jquery-ui-1.10.3.custom.min.js"></script>
	<!-- BOOTSTRAP -->
	<script src="bootstrap-dist/js/bootstrap.min.js"></script>
	<!-- DATE RANGE PICKER -->
	<script src="js/bootstrap-daterangepicker/moment.min.js"></script>
	<script src="js/bootstrap-daterangepicker/daterangepicker.min.js"></script>
	<!-- SLIMSCROLL -->
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/jquery.slimscroll.min.js"></script>
	<script type="text/javascript" src="js/jQuery-slimScroll-1.3.0/slimScrollHorizontal.min.js"></script>
	<!-- BLOCK UI -->
	<script type="text/javascript" src="js/jQuery-BlockUI/jquery.blockUI.min.js"></script>
	<!-- JQGRID -->
	<script type="text/javascript" src="js/jqgrid/js/grid.locale-en.min.js"></script>
	<script type="text/javascript" src="js/jqgrid/js/jquery.jqGrid.min.js"></script>
	<!-- COOKIE -->
	<script type="text/javascript" src="js/jQuery-Cookie/jquery.cookie.min.js"></script>
	<!-- HUBSPOT MESSENGER -->
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger.min.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-flat.js"></script>
	<script type="text/javascript" src="js/hubspot-messenger/js/messenger-theme-future.js"></script>
	<script src="js/script.js"></script>
	<!-- CLOSURE-LIBRARY -->
	<script src="closure-library/closure/goog/base.js"></script>
	<!-- ANGULAR-LIBRARY -->
	<script src="angular-1.5.0-rc.2/angular.js"></script>
	<!-- CUSTOM SCRIPT -->
	<script src="include/common.js"></script>
	<script>
	var app = angular.module("app", []);
	app.controller('ctrl', function($scope, $http, $httpParamSerializer, $injector, $window) {
		$scope.station = {
				"id": "${param.id}"
			}
	
			$scope.reload = function() {
				var reqDate = jQuery.param({
					"id": $scope.station.id
				});
				 var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
				$http.post(
					"api/resourecStation/queryById", reqDate, reqConfig
				).success(function(data, status) {
					if (isErr(data)) {
						showErrMsg(data);
						return;
					}
					$scope.resp = data.response;
					if(data.response.state==0){
						$scope.state1='空闲';
					}else if(data.response.state==1){
						$scope.state1='出租';
					}else if(data.response.state==2){
						$scope.state1='锁定';
					}
				}).error(function(data, status) {
					showNetworkErrMsg(data, status);
				});
			};
		//验证location	
		$scope.chaeckLocation = function(id){
			var reqDate = jQuery.param({
				"id":id,
				"zone": $scope.resp.zone,
				"location":$scope.resp.location
				
			});
		 	 var reqConfig = { headers: { "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"} };
			$http.post(
					"api/resourecStation/checkLocation", reqDate, reqConfig
				).success(function(data, status) {
					 if (isErr(data)) {
						showErrMsg(data);
						return;
					} 
					  if(data.response){
						 showMsg("地址已存在请重新输入");
						 $scope.resp.location=""; 
					}   
					
					
				}).error(function(data, status) {
					showNetworkErrMsg(data, status);
				}); 
		};

		//提交修改内容
		/* $scope.submit = function(id) {
			$scope.state=0;
			var param = {
				"id": id,
				"name": $scope.resp.zone,
				"rental": $scope.resp.rental
			};
			jQuery.post("api/resourecStation/edit", param, function(data) {
				isErr(data) ? showErrMsg(data) : showMsg('修改工位成功！');
			});
		} */
		
		$scope.logout = function() {
			logout($window);
		};
		$scope.stateType=["空闲", "出租", "锁定"];
	});
	</script>
	<script>
	jQuery(document).ready(function() {
		App.init();
		jQuery('#nav_resource-manage').click();
		//加载queryAllArticleType方法
		setTimeout(function () {
			var scope = angular.element('#app').scope();
			scope.reload();
			scope.queryAllState();
		}, 500);
	});
	</script>
	<!-- /JAVASCRIPTS -->
</body>
</html>